from django.db import models


# Create your models here.
class multimedia(models.Model):
    """
    媒体表
    """
    MEDIA_TYPE_CHOICES = [
        ('image', 'Image'),
        ('audio', 'Audio'),
        ('video', 'Video'),
    ]

    id = models.AutoField(primary_key=True)  # 媒体ID
    type = models.CharField(max_length=10, choices=MEDIA_TYPE_CHOICES)  # 媒体类型
    file_path = models.CharField(max_length=255)  # 文件路径
    description = models.TextField(blank=True, null=True)  # 描述
    created_at = models.DateTimeField(auto_now_add=True)  # 创建时间
    updated_at = models.DateTimeField(auto_now=True)  # 更新时间

    def __str__(self):
        return f"{self.type}: {self.file_path}"
